package com.hspedu.homework.homework13;

/**
 * @Author Stringzhua
 * @Date 2024/3/3 20:03
 * description:Teacher类
 * 属性:名字name,性别sex,年龄age,工龄work_age
 * 做合理封装,通过构造器在创建对象时,将4个属性赋值
 */
public class Teacher extends Person {
    //属性
    private int work_age;

    //方法
//构造器
    public Teacher(String name, char gender, int age, int work_age) {
        super(name, gender, age);
        this.work_age = work_age;
    }

    //get/set方法
    public int getWork_age() {
        return work_age;
    }

    public void setWork_age(int work_age) {
        this.work_age = work_age;
    }

    //老师有一个教学的方法
    public void teach() {
        System.out.println(getName() + "承诺我会认真教学~");
    }
    /*
     * 老师爱玩象棋
     * */

    @Override
    public String play() {
        return super.play() + "象棋";
    }

    //打印方法
    public void printInfo() {
        System.out.println("老师的信息");
        System.out.println(super.basicInfo());
        System.out.println("工龄:" + work_age);
        teach();
        System.out.println(play());
    }

    @Override
    public String toString() {
        return "Teacher{" +
                "work_age=" + work_age +
                '}' + super.toString();
    }
}
